home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / Filmposter-archiv (DE).ifs < prev    next >
Encoding:
Text File  |  2004-03-20  |  4.3 KB  |  139 lines

  1. // GETINFO SCRIPTING
  2. // Bild von Filmposter-archiv.de
  3.  
  4. (***************************************************
  5.  *  Movie importation script for                   *
  6.  *    Filmposter-archive.de                        *
  7.  *                                                 *
  8.  *  (c) 2003 Nik0                                  *
  9.  *                                                 *
  10.  *  For use with Ant Movie Catalog 3.4.0           *
  11.  *  www.antp.be/software/moviecatalog              *
  12.  *                                                 *
  13.  *  This program is free software; you can         *
  14.  *  redistribute it and/or modify it under the     *
  15.  *  terms of the GNU General Public License as     *
  16.  *  published by the Free Software Foundation;     *
  17.  *  either version 2 of the License, or (at your   *
  18.  *  option) any later version.                     *
  19.  ***************************************************)
  20.  
  21. program filmposterarchiv;
  22. var
  23.   MovieName: string;
  24.  
  25. const
  26.   fp_Server = 'http://www.filmposter-archiv.de/';
  27.  
  28. function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
  29. var
  30.   i: Integer;
  31. begin
  32.   result := -1;
  33.   if StartAt < 0 then
  34.     StartAt := 0;
  35.   for i := StartAt to List.Count-1 do
  36.     if Pos(Pattern, List.GetString(i)) <> 0 then
  37.     begin
  38.       result := i;
  39.       Break;
  40.     end;
  41. end;
  42.  
  43. // wenn mehrere Ergebnisse
  44. procedure AnalyzePage(Address: string);
  45. var
  46.   Page: TStringList;
  47.   LineNr: Integer;
  48. begin
  49.   Page := TStringList.Create;
  50.   Page.Text := GetPage(Address);
  51.   if pos('<TITLE>Filmposter-Archiv - Filmposter-Suche', Page.Text) = 0 then
  52.   begin
  53.     AnalyzeMoviePage(Page)
  54.   end else
  55.   begin
  56.     PickTreeClear;
  57.     LineNr := 0;
  58.     LineNr := FindLine('<OL>', Page, LineNr);
  59.     if LineNr > -1 then
  60.     begin
  61.       PickTreeAdd('Suche nach "' + MovieName + '" ergab mehrere Treffer:', '');
  62.       AddMoviesTitles(Page, LineNr);
  63.     end;
  64.     if PickTreeExec(Address) then
  65.       AnalyzePage(Address);
  66.   end;
  67.   Page.Free;
  68. end;
  69.  
  70. //wenn Filmseite
  71. procedure AnalyzeMoviePage(Page: TStringList);
  72. var
  73.   Line, Value, Value2, FullValue: string;
  74.   LineNr: Integer;
  75.   BeginPos, EndPos: Integer;
  76. begin
  77.  
  78.   // Picture
  79.   LineNr := FindLine('<IMG SRC="../p_', Page, 0);
  80.   if LineNr > -1 then
  81.   begin
  82.     Line := Page.GetString(LineNr);
  83.     BeginPos := pos('SRC="', Line) + 4;
  84.     Delete(Line, 1, BeginPos);
  85.     EndPos := pos('"', Line);
  86.     Value := copy(Line, 1, EndPos - 1);
  87.     GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
  88.   end;
  89.   DisplayResults;
  90. end;
  91.  
  92. procedure AddMoviesTitles(Page: TStringList; var LineNr: Integer);
  93. var
  94.   Line: string;
  95.   MovieTitle, MovieAddress, PictureKiloByte, AdditionalInfo: string;
  96.   StartPos: Integer;
  97. begin
  98.   repeat
  99.     LineNr := LineNr + 1;
  100.     Line := Page.GetString(LineNr);
  101. //    ShowMessage(Line);
  102.     StartPos := pos('<LI>', Line);
  103.     if StartPos > 0 then
  104.     begin
  105.       StartPos := StartPos + 4;
  106.       MovieTitle := copy(Line, StartPos, pos(' <A', Line) - StartPos);
  107.       HTMLDecode(Movietitle);
  108.       HTMLRemoveTags(Movietitle);
  109.      
  110.       StartPos := pos(' kByte', Line) - 3;
  111.       PictureKiloByte := copy(Line, StartPos, pos(' kByte', Line) - StartPos);
  112.       MovieTitle := MovieTitle + ' | ' + Trim(PictureKiloByte) + ' kByte';
  113.  
  114.       StartPos := pos('[', Line) + 1;
  115.       AdditionalInfo := copy(Line, StartPos, pos(']', Line) - StartPos);
  116.       if AdditionalInfo <> '' then
  117.         MovieTitle := MovieTitle + ' | [' + AdditionalInfo + ']';
  118.       StartPos := pos('_gr.php3?id=', Line) + 12;
  119.       MovieAddress := copy(Line, StartPos, pos('" TARGET="', Line) - StartPos);
  120.       PickTreeAdd(MovieTitle, fp_Server + 'html/anzeige_gr.php3?id=' + MovieAddress);
  121.     end;
  122.   until pos('</OL>', Line) > 0;
  123. end;
  124.  
  125. begin
  126.   if CheckVersion(3,4,0) then
  127.   begin
  128.     MovieName := GetField(fieldOriginalTitle);
  129.     if MovieName = '' then
  130.       MovieName := GetField(fieldTranslatedTitle);
  131.     if Input('Filmposter-Archiv.de', 'Geben Sie den Namen den Films ein:', MovieName) then
  132.     begin
  133.       AnalyzePage( fp_Server + 'html/suche.php3?sent=1&language=german&filmtitel='+UrlEncode(MovieName));
  134.     end;
  135.   end else
  136.     ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
  137. end.
  138.  
  139.